<template>
  <div class="deposit_mod" :class="themeClass">
    <v-loading v-if="loading" />
    <v-nav :title="$t('Withdraw.withdraw')" v-if="isDayTime === false" title_color="#fff" :class="themeClass">
      <a @click="$router.push('/asset/withdrawdetails')" :class="bgColor">{{ $t('Withdraw.Withdrawal details') }}</a>
    </v-nav>
    <v-nav :title="$t('Withdraw.withdraw')" v-if="isDayTime === true">
      <a @click="$router.push('/asset/withdrawdetails')">{{ $t('Withdraw.Withdrawal details') }}</a>
    </v-nav>
    <div class="deposit_mod_box">
      <div class="deposit_mod_box_currency" v-for="(item, index) in withdrawalList" :key="index">
        <router-link :to="`withdrawCurrency?detail=${item.id}`" class="custom_cell" :class="themeClass1">
          <div style="display: flex">
            <img :src="item.logo_link" alt="" />
            <span class="custom-title" :class="bgColor">{{ item.currency }} {{ $t('Withdraw.withdraw') }}</span>
          </div>
          <van-icon name="arrow" />
        </router-link>
      </div>
      <div class="deposit_mod_box_desc">
        <div>
          <h1>{{ $t('Withdraw.Kind tips') }}</h1>
          <p>{{ $t('Withdraw.info1') }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Deposit',
  data() {
    return {
      withdrawalList: [],
      isDayTime: false,
      loading: false
    }
  },
  computed: {
    themeClass() {
      return this.isDayTime ? '' : 'darknight'
    },
    bgColor() {
      return this.isDayTime ? 'black' : 'white'
    },
    themeClass1() {
      return this.isDayTime ? '' : 'dark_li_color'
    }
  },
  watch: {
    '$store.state.nightMode': {
      handler(newVal) {
        this.isDayTime = newVal
      },
      immediate: true
    }
  },
  activated() {
    this.getWithdrawList()
  },
  methods: {
    async getWithdrawList() {
      this.loading = true
      await this.$https.get('/platform/getWithdraw').then(res => {
        if (res != undefined && res.code == 1) {
          this.withdrawalList = res.data
        }
      })
      this.loading = false
    }
  }
}
</script>

<style lang="less" scoped>
@import url('../Deposit/index.less');
.deposit_mod_box_desc {
  padding-top: 12px;

  & > div {
    font-family: Roboto-Regular, Roboto;

    h1 {
      font-size: 12px;
      font-weight: 600;
      color: #1a1a1a;
      margin-bottom: 12px;
      font-family: Roboto-Regular, Roboto;
    }

    p {
      color: #878999;
    }
  }
}
.daytime {
  background: #fff;
  color: black;
}
.active1 {
  background: #121212;
  color: #fff;
}
.darknight {
  background: #191b27 !important;
  color: #fff;
}

.dark_li_color {
  /deep/.van-field__control {
    color: #dde2ec !important;
  }
  background-color: #000000 !important;
  color: #fff !important;
}
.white {
  color: #fff !important;
}
</style>
